package com.shujia.homework;

public class StudentEntry {

    private Integer id;
    private Student student;


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Student getStudent() {
        return student;
    }

    public void setStudent(Student student) {
        this.student = student;
    }

    /*
    StudentEntry 是要保存到List， 所以要重写equals方法
     */
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        StudentEntry that = (StudentEntry) o;

        if (id != null ? !id.equals(that.id) : that.id != null) return false;
        return student != null ? student.equals(that.student) : that.student == null;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (student != null ? student.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "StudentEntry{" +
                "id=" + id +
                ", student=" + student +
                '}';
    }
}
